Skip to content

Java: Standardize hooks + middleware implementation with other languages - #1519

Merged
brandur merged 1 commit into
masterfrom
brandur-java-plugin-fix
Oct 24, 2026
Merged

brandur merged 1 commit into
masterfrom
brandur-java-plugin-fix

Conversation

@brandur

@brandur brandur commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

I noticed today that Java had been done something a little weird in that
instead of hooks/middleware like in Go, we ended up with a broad
Extension interface that does everything.

Here, give Java a more normal implementation compared to other
languages. We have specific hooks/middleware like:

public interface HookInsertBegin extends Hook {
  /**
   * Runs in the insertion's transaction. Throwing fails and rolls back the insertion, including
   * application writes made using this connection. Options are the caller's overrides, before
   * merging with job-type defaults.
   */
  void insertBegin(Connection connection, JobType<?> type, Object args, InsertOptions options)
      throws Exception;
}

Which extends from a base like Hook:

public interface Hook extends Plugin {}

Which extends from Plugin so that everything can be set together:

public interface Plugin {}

@brandur
brandur requested a review from bgentry October 18, 2026 04:02
@bgentry

bgentry commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T13:50:40.522963Z f7bafb0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: f7bafb0d52

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bgentry bgentry left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing a changelog here, but otherwise LGTM

I noticed today that Java had been done something a little weird in that
instead of hooks/middleware like in Go, we ended up with a broad
`Extension` interface that does everything.

Here, give Java a more normal implementation compared to other
languages. We have specific hooks/middleware like:

    public interface HookInsertBegin extends Hook {
      /**
       * Runs in the insertion's transaction. Throwing fails and rolls back the insertion, including
       * application writes made using this connection. Options are the caller's overrides, before
       * merging with job-type defaults.
       */
      void insertBegin(Connection connection, JobType<?> type, Object args, InsertOptions options)
          throws Exception;
    }

Which extends from a base like `Hook`:

    public interface Hook extends Plugin {}

Which extends from `Plugin` so that everything can be set together:

    public interface Plugin {}
@brandur
brandur force-pushed the brandur-java-plugin-fix branch from f7bafb0 to 47abdf5 Compare October 24, 2026 16:45
@brandur

brandur commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Thx.

I'm not seeing a changelog here, but otherwise LGTM

Added. This is kind of a weird one though still because there's no official Java release yet so technically no changes to log.

@brandur
brandur merged commit 667e3ea into master Oct 24, 2026
27 of 31 checks passed
@brandur
brandur deleted the brandur-java-plugin-fix branch October 24, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants